<template>
    <el-select :options="options" v-model="model" placeholder="请选择违规类型" :multiple="props.multiple" size="large">
        <el-option
        v-for="item in options"
        :key="item.value"
        :label="item.label"
        :value="item.value"
      />
    </el-select>
</template>
<script setup>
import {ref, defineModel, defineEmit, defineProps} from 'vue'
import axios from 'axios'
import {ElMessage} from 'element-plus'
const options = ref([])
const model = defineModel()
const props1 = ref({
  multiple: true,
})
const props = defineProps({
    multiple: {
        type: Boolean,
        default: true
    }
})
const init = async() => {
    const res = await axios.get(`/system/violation/basic`)
    const {code, msg, data} = res.data
    if (code == 200) {
        options.value = data.map(item => ({
            label: item.content,
            value: item.id
        }))
    } else {
        ElMessage.error(msg)
    }
}
init()
</script>